<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
<!-- qstatictext.cpp -->
  <title>QStaticText Class | Qt GUI 5.14.2</title>
  <link rel="stylesheet" type="text/css" href="style/offline-simple.css" />
  <script type="text/javascript">
    document.getElementsByTagName("link").item(0).setAttribute("href", "style/offline.css");
    // loading style sheet breaks anchors that were jumped to before
    // so force jumping to anchor again
    setTimeout(function() {
        var anchor = location.hash;
        // need to jump to different anchor first (e.g. none)
        location.hash = "#";
        setTimeout(function() {
            location.hash = anchor;
        }, 0);
    }, 0);
  </script>
</head>
<body>
<div class="header" id="qtdocheader">
  <div class="main">
    <div class="main-rounded">
      <div class="navigationbar">
        <table><tr>
<td ><a href="../qtdoc/index.html">Qt 5.14</a></td><td ><a href="qtgui-index.html">Qt GUI</a></td><td ><a href="qtgui-module.html">C++ Classes</a></td><td >QStaticText</td></tr></table><table class="buildversion"><tr>
<td id="buildversion" width="100%" align="right"><a href="qtgui-index.html">Qt 5.14.2 Reference Documentation</a></td>
        </tr></table>
      </div>
    </div>
<div class="content">
<div class="line">
<div class="content mainContent">
<div class="sidebar">
<div class="toc">
<h3><a name="toc">Contents</a></h3>
<ul>
<li class="level1"><a href="#public-types">Public Types</a></li>
<li class="level1"><a href="#public-functions">Public Functions</a></li>
<li class="level1"><a href="#details">Detailed Description</a></li>
</ul>
</div>
<div class="sidebar-content" id="sidebar-content"></div></div>
<h1 class="title">QStaticText Class</h1>
<!-- $$$QStaticText-brief -->
<p>The QStaticText class enables optimized drawing of text when the text and its layout is updated rarely. <a href="#details">More...</a></p>
<!-- @@@QStaticText -->
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> Header:</td><td class="memItemRight bottomAlign">   <span class="preprocessor">#include &lt;QStaticText&gt;</span>
</td></tr><tr><td class="memItemLeft rightAlign topAlign"> qmake:</td><td class="memItemRight bottomAlign"> QT += gui</td></tr><tr><td class="memItemLeft rightAlign topAlign"> Since:</td><td class="memItemRight bottomAlign"> Qt 4.7</td></tr></table></div><p>This class was introduced in Qt 4.7.</p>
<ul>
<li><a href="qstatictext-members.html">List of all members, including inherited members</a></li>
</ul>
<a name="public-types"></a>
<h2 id="public-types">Public Types</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> enum </td><td class="memItemRight bottomAlign"><b><a href="qstatictext.html#PerformanceHint-enum">PerformanceHint</a></b> { ModerateCaching, AggressiveCaching }</td></tr>
</table></div>
<a name="public-functions"></a>
<h2 id="public-functions">Public Functions</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qstatictext.html#QStaticText-2">QStaticText</a></b>(const QStaticText &amp;<i>other</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qstatictext.html#QStaticText-1">QStaticText</a></b>(const QString &amp;<i>text</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qstatictext.html#QStaticText">QStaticText</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QStaticText &amp;</td><td class="memItemRight bottomAlign"><b><a href="qstatictext.html#operator-eq-1">operator=</a></b>(const QStaticText &amp;<i>other</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qstatictext.html#dtor.QStaticText">~QStaticText</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QStaticText::PerformanceHint </td><td class="memItemRight bottomAlign"><b><a href="qstatictext.html#performanceHint">performanceHint</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qstatictext.html#prepare">prepare</a></b>(const QTransform &amp;<i>matrix</i> = QTransform(), const QFont &amp;<i>font</i> = QFont())</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qstatictext.html#setPerformanceHint">setPerformanceHint</a></b>(QStaticText::PerformanceHint <i>performanceHint</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qstatictext.html#setText">setText</a></b>(const QString &amp;<i>text</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qstatictext.html#setTextFormat">setTextFormat</a></b>(Qt::TextFormat <i>textFormat</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qstatictext.html#setTextOption">setTextOption</a></b>(const QTextOption &amp;<i>textOption</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qstatictext.html#setTextWidth">setTextWidth</a></b>(qreal <i>textWidth</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QSizeF </td><td class="memItemRight bottomAlign"><b><a href="qstatictext.html#size">size</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qstatictext.html#swap">swap</a></b>(QStaticText &amp;<i>other</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qstatictext.html#text">text</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> Qt::TextFormat </td><td class="memItemRight bottomAlign"><b><a href="qstatictext.html#textFormat">textFormat</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QTextOption </td><td class="memItemRight bottomAlign"><b><a href="qstatictext.html#textOption">textOption</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> qreal </td><td class="memItemRight bottomAlign"><b><a href="qstatictext.html#textWidth">textWidth</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qstatictext.html#operator-not-eq">operator!=</a></b>(const QStaticText &amp;<i>other</i>) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qstatictext.html#operator-eq-eq">operator==</a></b>(const QStaticText &amp;<i>other</i>) const</td></tr>
</table></div>
<a name="details"></a>
<!-- $$$QStaticText-description -->
<div class="descr">
<h2 id="details">Detailed Description</h2>
<p>QStaticText provides a way to cache layout data for a block of text so that it can be drawn more efficiently than by using <a href="qpainter.html#drawText">QPainter::drawText</a>() in which the layout information is recalculated with every call.</p>
<p>The class primarily provides an optimization for cases where the text, its font and the transformations on the painter are static over several paint events. If the text or its layout is changed for every iteration, <a href="qpainter.html#drawText">QPainter::drawText</a>() is the more efficient alternative, since the static text's layout would have to be recalculated to take the new state into consideration.</p>
<p>Translating the painter will not cause the layout of the text to be recalculated, but will cause a very small performance impact on drawStaticText(). Altering any other parts of the painter's transformation or the painter's font will cause the layout of the static text to be recalculated. This should be avoided as often as possible to maximize the performance benefit of using QStaticText.</p>
<p>In addition, only affine transformations are supported by drawStaticText(). Calling drawStaticText() on a projected painter will perform slightly worse than using the regular drawText() call, so this should be avoided.</p>
<pre class="cpp">

  <span class="keyword">class</span> MyWidget: <span class="keyword">public</span> <span class="type"><a href="../qtwidgets/qwidget.html">QWidget</a></span>
  {
  <span class="keyword">public</span>:
      MyWidget(<span class="type"><a href="../qtwidgets/qwidget.html">QWidget</a></span> <span class="operator">*</span>parent <span class="operator">=</span> <span class="number">0</span>) : <span class="type"><a href="../qtwidgets/qwidget.html">QWidget</a></span>(parent)<span class="operator">,</span> m_staticText(<span class="string">&quot;This is static text&quot;</span>)

  <span class="keyword">protected</span>:
      <span class="type">void</span> paintEvent(<span class="type"><a href="qpaintevent.html">QPaintEvent</a></span> <span class="operator">*</span>)
      {
          <span class="type"><a href="qpainter.html">QPainter</a></span> painter(<span class="keyword">this</span>);
          painter<span class="operator">.</span>drawStaticText(<span class="number">0</span><span class="operator">,</span> <span class="number">0</span><span class="operator">,</span> m_staticText);
      }

  <span class="keyword">private</span>:
      <span class="type"><a href="qstatictext.html#QStaticText">QStaticText</a></span> m_staticText;
  };

</pre>
<p>The QStaticText class can be used to mimic the behavior of <a href="qpainter.html#drawText">QPainter::drawText</a>() to a specific point with no boundaries, and also when <a href="qpainter.html#drawText">QPainter::drawText</a>() is called with a bounding rectangle.</p>
<p>If a bounding rectangle is not required, create a QStaticText object without setting a preferred text width. The text will then occupy a single line.</p>
<p>If you set a text width on the QStaticText object, this will bound the text. The text will be formatted so that no line exceeds the given width. The text width set for QStaticText will not automatically be used for clipping. To achieve clipping in addition to line breaks, use <a href="qpainter.html#setClipRect">QPainter::setClipRect</a>(). The position of the text is decided by the argument passed to <a href="qpainter.html#drawStaticText">QPainter::drawStaticText</a>() and can change from call to call with a minimal impact on performance.</p>
<p>For extra convenience, it is possible to apply formatting to the text using the HTML subset supported by <a href="qtextdocument.html">QTextDocument</a>. QStaticText will attempt to guess the format of the input text using <a href="qt-sub-qtgui.html#mightBeRichText">Qt::mightBeRichText</a>(), and interpret it as rich text if this function returns <code>true</code>. To force QStaticText to display its contents as either plain text or rich text, use the function <a href="qstatictext.html#setTextFormat">QStaticText::setTextFormat</a>() and pass in, respectively, <a href="../qtcore/qt.html#TextFormat-enum">Qt::PlainText</a> and <a href="../qtcore/qt.html#TextFormat-enum">Qt::RichText</a>.</p>
<p>QStaticText can only represent text, so only HTML tags which alter the layout or appearance of the text will be respected. Adding an image to the input HTML, for instance, will cause the image to be included as part of the layout, affecting the positions of the text glyphs, but it will not be displayed. The result will be an empty area the size of the image in the output. Similarly, using tables will cause the text to be laid out in table format, but the borders will not be drawn.</p>
<p>If it's the first time the static text is drawn, or if the static text, or the painter's font has been altered since the last time it was drawn, the text's layout has to be recalculated. On some paint engines, changing the matrix of the painter will also cause the layout to be recalculated. In particular, this will happen for any engine except for the OpenGL2 paint engine. Recalculating the layout will impose an overhead on the <a href="qpainter.html#drawStaticText">QPainter::drawStaticText</a>() call where it occurs. To avoid this overhead in the paint event, you can call <a href="qstatictext.html#prepare">prepare</a>() ahead of time to ensure that the layout is calculated.</p>
</div>
<p><b>See also </b><a href="qpainter.html#drawText">QPainter::drawText</a>(), <a href="qpainter.html#drawStaticText">QPainter::drawStaticText</a>(), <a href="qtextlayout.html">QTextLayout</a>, and <a href="qtextdocument.html">QTextDocument</a>.</p>
<!-- @@@QStaticText -->
<div class="types">
<h2>Member Type Documentation</h2>
<!-- $$$PerformanceHint$$$ModerateCaching$$$AggressiveCaching -->
<h3 class="fn" id="PerformanceHint-enum"><a name="PerformanceHint-enum"></a>enum QStaticText::<span class="name">PerformanceHint</span></h3>
<p>This enum the different performance hints that can be set on the <a href="qstatictext.html">QStaticText</a>. These hints can be used to indicate that the <a href="qstatictext.html">QStaticText</a> should use additional caches, if possible, to improve performance at the expense of memory. In particular, setting the performance hint AggressiveCaching on the <a href="qstatictext.html">QStaticText</a> will improve performance when using the OpenGL graphics system or when drawing to a <a href="../qtwidgets/qopenglwidget.html">QOpenGLWidget</a>.</p>
<div class="table"><table class="valuelist"><tr valign="top" class="odd"><th class="tblConst">Constant</th><th class="tblval">Value</th><th class="tbldscr">Description</th></tr>
<tr><td class="topAlign"><code>QStaticText::ModerateCaching</code></td><td class="topAlign tblval"><code>0</code></td><td class="topAlign">Do basic caching for high performance at a low memory cost.</td></tr>
<tr><td class="topAlign"><code>QStaticText::AggressiveCaching</code></td><td class="topAlign tblval"><code>1</code></td><td class="topAlign">Use additional caching when available. This may improve performance at a higher memory cost.</td></tr>
</table></div>
<!-- @@@PerformanceHint -->
</div>
<div class="func">
<h2>Member Function Documentation</h2>
<!-- $$$QStaticText$$$QStaticTextconstQStaticText& -->
<h3 class="fn" id="QStaticText-2"><a name="QStaticText-2"></a>QStaticText::<span class="name">QStaticText</span>(const <span class="type"><a href="qstatictext.html#QStaticText">QStaticText</a></span> &amp;<i>other</i>)</h3>
<p>Constructs a QStaticText object which is a copy of <i>other</i>.</p>
<!-- @@@QStaticText -->
<!-- $$$QStaticText$$$QStaticTextconstQString& -->
<h3 class="fn" id="QStaticText-1"><a name="QStaticText-1"></a>QStaticText::<span class="name">QStaticText</span>(const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &amp;<i>text</i>)</h3>
<p>Constructs a QStaticText object with the given <i>text</i>.</p>
<!-- @@@QStaticText -->
<!-- $$$QStaticText[overload1]$$$QStaticText -->
<h3 class="fn" id="QStaticText"><a name="QStaticText"></a>QStaticText::<span class="name">QStaticText</span>()</h3>
<p>Constructs an empty QStaticText</p>
<!-- @@@QStaticText -->
<!-- $$$operator=$$$operator=constQStaticText& -->
<h3 class="fn" id="operator-eq-1"><a name="operator-eq-1"></a><span class="type"><a href="qstatictext.html#QStaticText">QStaticText</a></span> &amp;QStaticText::<span class="name">operator=</span>(const <span class="type"><a href="qstatictext.html#QStaticText">QStaticText</a></span> &amp;<i>other</i>)</h3>
<p>Assigns <i>other</i> to this <a href="qstatictext.html">QStaticText</a>.</p>
<!-- @@@operator= -->
<!-- $$$~QStaticText[overload1]$$$~QStaticText -->
<h3 class="fn" id="dtor.QStaticText"><a name="dtor.QStaticText"></a>QStaticText::<span class="name">~QStaticText</span>()</h3>
<p>Destroys the <a href="qstatictext.html">QStaticText</a>.</p>
<!-- @@@~QStaticText -->
<!-- $$$performanceHint[overload1]$$$performanceHint -->
<h3 class="fn" id="performanceHint"><a name="performanceHint"></a><span class="type"><a href="qstatictext.html#PerformanceHint-enum">QStaticText::PerformanceHint</a></span> QStaticText::<span class="name">performanceHint</span>() const</h3>
<p>Returns which performance hint is set for the <a href="qstatictext.html">QStaticText</a>.</p>
<p><b>See also </b><a href="qstatictext.html#setPerformanceHint">setPerformanceHint</a>().</p>
<!-- @@@performanceHint -->
<!-- $$$prepare[overload1]$$$prepareconstQTransform&constQFont& -->
<h3 class="fn" id="prepare"><a name="prepare"></a><span class="type">void</span> QStaticText::<span class="name">prepare</span>(const <span class="type"><a href="qtransform.html">QTransform</a></span> &amp;<i>matrix</i> = QTransform(), const <span class="type"><a href="qfont.html">QFont</a></span> &amp;<i>font</i> = QFont())</h3>
<p>Prepares the <a href="qstatictext.html">QStaticText</a> object for being painted with the given <i>matrix</i> and the given <i>font</i> to avoid overhead when the actual drawStaticText() call is made.</p>
<p>When drawStaticText() is called, the layout of the <a href="qstatictext.html">QStaticText</a> will be recalculated if any part of the <a href="qstatictext.html">QStaticText</a> object has changed since the last time it was drawn. It will also be recalculated if the painter's font is not the same as when the <a href="qstatictext.html">QStaticText</a> was last drawn, or, on any other paint engine than the OpenGL2 engine, if the painter's matrix has been altered since the static text was last drawn.</p>
<p>To avoid the overhead of creating the layout the first time you draw the <a href="qstatictext.html">QStaticText</a> after making changes, you can use the prepare() function and pass in the <i>matrix</i> and <i>font</i> you expect to use when drawing the text.</p>
<p><b>See also </b><a href="qpainter.html#setFont">QPainter::setFont</a>() and <a href="qpainter-obsolete.html#setMatrix">QPainter::setMatrix</a>().</p>
<!-- @@@prepare -->
<!-- $$$setPerformanceHint[overload1]$$$setPerformanceHintQStaticText::PerformanceHint -->
<h3 class="fn" id="setPerformanceHint"><a name="setPerformanceHint"></a><span class="type">void</span> QStaticText::<span class="name">setPerformanceHint</span>(<span class="type"><a href="qstatictext.html#PerformanceHint-enum">QStaticText::PerformanceHint</a></span> <i>performanceHint</i>)</h3>
<p>Sets the performance hint of the <a href="qstatictext.html">QStaticText</a> according to the <i>performanceHint</i> provided. The <i>performanceHint</i> is used to customize how much caching is done internally to improve performance.</p>
<p>The default is <a href="qstatictext.html#PerformanceHint-enum">QStaticText::ModerateCaching</a>.</p>
<p><b>Note: </b>This function will cause the layout of the text to require recalculation.</p><p><b>See also </b><a href="qstatictext.html#performanceHint">performanceHint</a>().</p>
<!-- @@@setPerformanceHint -->
<!-- $$$setText[overload1]$$$setTextconstQString& -->
<h3 class="fn" id="setText"><a name="setText"></a><span class="type">void</span> QStaticText::<span class="name">setText</span>(const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &amp;<i>text</i>)</h3>
<p>Sets the text of the <a href="qstatictext.html">QStaticText</a> to <i>text</i>.</p>
<p><b>Note: </b>This function will cause the layout of the text to require recalculation.</p><p><b>See also </b><a href="qstatictext.html#text">text</a>().</p>
<!-- @@@setText -->
<!-- $$$setTextFormat[overload1]$$$setTextFormatQt::TextFormat -->
<h3 class="fn" id="setTextFormat"><a name="setTextFormat"></a><span class="type">void</span> QStaticText::<span class="name">setTextFormat</span>(<span class="type"><a href="../qtcore/qt.html#TextFormat-enum">Qt::TextFormat</a></span> <i>textFormat</i>)</h3>
<p>Sets the text format of the <a href="qstatictext.html">QStaticText</a> to <i>textFormat</i>. If <i>textFormat</i> is set to <a href="../qtcore/qt.html#TextFormat-enum">Qt::AutoText</a> (the default), the format of the text will try to be determined using the function <a href="qt-sub-qtgui.html#mightBeRichText">Qt::mightBeRichText</a>(). If the text format is <a href="../qtcore/qt.html#TextFormat-enum">Qt::PlainText</a>, then the text will be displayed as is, whereas it will be interpreted as HTML if the format is <a href="../qtcore/qt.html#TextFormat-enum">Qt::RichText</a>. HTML tags that alter the font of the text, its color, or its layout are supported by <a href="qstatictext.html">QStaticText</a>.</p>
<p><b>Note: </b>This function will cause the layout of the text to require recalculation.</p><p><b>See also </b><a href="qstatictext.html#textFormat">textFormat</a>(), <a href="qstatictext.html#setText">setText</a>(), and <a href="qstatictext.html#text">text</a>().</p>
<!-- @@@setTextFormat -->
<!-- $$$setTextOption[overload1]$$$setTextOptionconstQTextOption& -->
<h3 class="fn" id="setTextOption"><a name="setTextOption"></a><span class="type">void</span> QStaticText::<span class="name">setTextOption</span>(const <span class="type"><a href="qtextoption.html">QTextOption</a></span> &amp;<i>textOption</i>)</h3>
<p>Sets the text option structure that controls the layout process to the given <i>textOption</i>.</p>
<p><b>See also </b><a href="qstatictext.html#textOption">textOption</a>().</p>
<!-- @@@setTextOption -->
<!-- $$$setTextWidth[overload1]$$$setTextWidthqreal -->
<h3 class="fn" id="setTextWidth"><a name="setTextWidth"></a><span class="type">void</span> QStaticText::<span class="name">setTextWidth</span>(<span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span> <i>textWidth</i>)</h3>
<p>Sets the preferred width for this <a href="qstatictext.html">QStaticText</a>. If the text is wider than the specified width, it will be broken into multiple lines and grow vertically. If the text cannot be split into multiple lines, it will be larger than the specified <i>textWidth</i>.</p>
<p>Setting the preferred text width to a negative number will cause the text to be unbounded.</p>
<p>Use <a href="qstatictext.html#size">size</a>() to get the actual size of the text.</p>
<p><b>Note: </b>This function will cause the layout of the text to require recalculation.</p><p><b>See also </b><a href="qstatictext.html#textWidth">textWidth</a>() and <a href="qstatictext.html#size">size</a>().</p>
<!-- @@@setTextWidth -->
<!-- $$$size[overload1]$$$size -->
<h3 class="fn" id="size"><a name="size"></a><span class="type"><a href="../qtcore/qsizef.html">QSizeF</a></span> QStaticText::<span class="name">size</span>() const</h3>
<p>Returns the size of the bounding rect for this <a href="qstatictext.html">QStaticText</a>.</p>
<p><b>See also </b><a href="qstatictext.html#textWidth">textWidth</a>().</p>
<!-- @@@size -->
<!-- $$$swap[overload1]$$$swapQStaticText& -->
<h3 class="fn" id="swap"><a name="swap"></a><span class="type">void</span> QStaticText::<span class="name">swap</span>(<span class="type"><a href="qstatictext.html#QStaticText">QStaticText</a></span> &amp;<i>other</i>)</h3>
<p>Swaps this static text instance with <i>other</i>. This function is very fast and never fails.</p>
<p>This function was introduced in Qt 5.0.</p>
<!-- @@@swap -->
<!-- $$$text[overload1]$$$text -->
<h3 class="fn" id="text"><a name="text"></a><span class="type"><a href="../qtcore/qstring.html">QString</a></span> QStaticText::<span class="name">text</span>() const</h3>
<p>Returns the text of the <a href="qstatictext.html">QStaticText</a>.</p>
<p><b>See also </b><a href="qstatictext.html#setText">setText</a>().</p>
<!-- @@@text -->
<!-- $$$textFormat[overload1]$$$textFormat -->
<h3 class="fn" id="textFormat"><a name="textFormat"></a><span class="type"><a href="../qtcore/qt.html#TextFormat-enum">Qt::TextFormat</a></span> QStaticText::<span class="name">textFormat</span>() const</h3>
<p>Returns the text format of the <a href="qstatictext.html">QStaticText</a>.</p>
<p><b>See also </b><a href="qstatictext.html#setTextFormat">setTextFormat</a>(), <a href="qstatictext.html#setText">setText</a>(), and <a href="qstatictext.html#text">text</a>().</p>
<!-- @@@textFormat -->
<!-- $$$textOption[overload1]$$$textOption -->
<h3 class="fn" id="textOption"><a name="textOption"></a><span class="type"><a href="qtextoption.html">QTextOption</a></span> QStaticText::<span class="name">textOption</span>() const</h3>
<p>Returns the current text option used to control the layout process.</p>
<p><b>See also </b><a href="qstatictext.html#setTextOption">setTextOption</a>().</p>
<!-- @@@textOption -->
<!-- $$$textWidth[overload1]$$$textWidth -->
<h3 class="fn" id="textWidth"><a name="textWidth"></a><span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span> QStaticText::<span class="name">textWidth</span>() const</h3>
<p>Returns the preferred width for this <a href="qstatictext.html">QStaticText</a>.</p>
<p><b>See also </b><a href="qstatictext.html#setTextWidth">setTextWidth</a>().</p>
<!-- @@@textWidth -->
<!-- $$$operator!=[overload1]$$$operator!=constQStaticText& -->
<h3 class="fn" id="operator-not-eq"><a name="operator-not-eq"></a><span class="type">bool</span> QStaticText::<span class="name">operator!=</span>(const <span class="type"><a href="qstatictext.html#QStaticText">QStaticText</a></span> &amp;<i>other</i>) const</h3>
<p>Compares <i>other</i> to this <a href="qstatictext.html">QStaticText</a>. Returns <code>true</code> if the texts, fonts or maximum sizes are different.</p>
<!-- @@@operator!= -->
<!-- $$$operator==[overload1]$$$operator==constQStaticText& -->
<h3 class="fn" id="operator-eq-eq"><a name="operator-eq-eq"></a><span class="type">bool</span> QStaticText::<span class="name">operator==</span>(const <span class="type"><a href="qstatictext.html#QStaticText">QStaticText</a></span> &amp;<i>other</i>) const</h3>
<p>Compares <i>other</i> to this <a href="qstatictext.html">QStaticText</a>. Returns <code>true</code> if the texts, fonts and text widths are equal.</p>
<!-- @@@operator== -->
</div>
        </div>
       </div>
   </div>
   </div>
</div>
<div class="footer">
   <p>
   <acronym title="Copyright">&copy;</acronym> 2020 The Qt Company Ltd.
   Documentation contributions included herein are the copyrights of
   their respective owners.<br/>    The documentation provided herein is licensed under the terms of the    <a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation    License version 1.3</a> as published by the Free Software Foundation.<br/>    Qt and respective logos are trademarks of The Qt Company Ltd.     in Finland and/or other countries worldwide. All other trademarks are property
   of their respective owners. </p>
</div>
</body>
</html>
